package cn.edu.scau.cmi.liangzijian.proxy.dynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class DVisitProxy<T> {
	public static <T> T newProxyInstance(DVisit dVisit) {
		ClassLoader loader = dVisit.getClass().getClassLoader();
		Class<?>[] interfaces = dVisit.getClass().getInterfaces();
		InvocationHandler handler = new MyInvocationHandler(dVisit);
		
		return (T)Proxy.newProxyInstance(loader, interfaces, handler);
	}
}
